@extends('home.layouts')
@section('content')
    <div class="pet_content_main">
        <div data-am-widget="list_news" class="am-list-news am-list-news-default" >
            <div class="am-list-news-bd">

                <ul class="am-list">
                    <!--缩略图在标题右边-->
                    @if(count($mainContent)!=0)
                        @foreach($mainContent as $m)
                            @if(isset($m['banner']))
                                {{--文章--}}
                                <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-right pet_list_one_block">
                                    <div class="pet_list_one_info">
                                        <div class="pet_list_one_info">
                                            <div class="pet_list_one_info_l">
                                                <div class="pet_list_one_info_ico"><img src="
                        @if(empty($m['avatar']))
                                                    {{asset('assets/images/home/a1.png')}}
                                                    @else
                                                    {{$m['avatar']}}-40X40
                                    @endif
                                                            " alt=""></div>
                                                <div class="pet_list_one_info_name">
                                                    @if(empty($m['username']))
                                                        大佬
                                                    @else
                                                        {{$m['username']}}
                                                    @endif
                                                </div>
                                                <small> &nbsp;&nbsp;{{date('Y-m-d H:i:s',$m['created_at'])}}发布</small>
                                            </div>
                                            <div class="pet_list_one_info_r">
                                                <div class="pet_list_tag pet_list_tag_xxs">文章</div>
                                            </div>
                                        </div>
                                        <div class=" am-u-sm-8 am-list-main pet_list_one_nr">
                                            <h3 class="am-list-item-hd pet_list_one_bt"><a href="{{url('articledetail/'.$m['id'])}}" class="">{{$m['title']}}</a></h3>
                                            <div class="am-list-item-text pet_list_one_text">
                                                {{--                                {{mb_substr($m['content'],0,150,'utf-8')}}--}}
                                                {{--                                {!! $m['content'] !!}--}}
                                                {{--{{mb_substr(strip_tags(trim($m['content'])),0,500,'utf-8')}}--}}
                                                {{mb_substr(strip_tags(trim(strip_tags($m['content']))),0,150,'utf-8')}}
                                            </div>

                                        </div>
                                        <div class="am-u-sm-4 am-list-thumb">
                                            <a href="{{url('articledetail/'.$m['id'])}}" class="">
                                                @if(!empty($m['cover']))
                                                    <img src="{{$m['cover']}}-300X230" class="pet_list_one_img" style="height: 76px;width: 100px;" alt=""/>
                                                @else
                                                    <img src="{{asset('assets/images/home/q4.jpg')}}" class="pet_list_one_img" style="height: 76px;width: 100px;" alt=""/>
                                                @endif
                                            </a>
                                        </div>
                                </li>
                            @endif

                            @if(isset($m['images']))
                                {{--图集--}}
                                <li class="am-g am-list-item-desced pet_list_one_block">
                                    <div class="pet_list_one_info">
                                        <div class="pet_list_one_info_l">
                                            <div class="pet_list_one_info_ico"><img src="
                        @if(empty($m['avatar']))
                                                {{asset('assets/images/home/a1.png')}}
                                                @else
                                                {{$m['avatar']}}-40X40
                                    @endif
                                                        " alt=""></div>
                                            <div class="pet_list_one_info_name">
                                                @if(empty($m['username']))
                                                    大佬
                                                @else
                                                    {{$m['username']}}
                                                @endif
                                            </div>
                                            <small> &nbsp;&nbsp;{{date('Y-m-d H:i:s',$m['created_at'])}}发布</small>
                                        </div>
                                        <div class="pet_list_one_info_r">
                                            <div class="pet_list_tag pet_list_tag_kty">图集</div>
                                        </div>
                                    </div>
                                    <div class=" am-list-main">
                                        <h3 class="am-list-item-hd pet_list_one_bt"><a href="{{url('imagedetail/'.$m['id'])}}" class="">{{$m['title']}}</a></h3>
                                        <ul data-am-widget="gallery" class="am-gallery am-avg-sm-3 am-avg-md-3 am-avg-lg-3 am-gallery-default pet_list_one_list pet_list_one_tytj" >
                                            @foreach(json_decode($m['images']) as $k=>$image)
                                                @if($image!='undefined')
                                                    @if($k<6)
                                                        <li>
                                                            <div class="am-gallery-item">
                                                                <a href="{{url('imagedetail/'.$m['id'])}}" class="">
                                                                    <img src="{{$image}}-300X230"  alt="图片" style="height: 81px;width: 106px;" />
                                                                </a>
                                                            </div>
                                                        </li>
                                                    @endif
                                                @endif
                                            @endforeach
                                        </ul>
                                    </div>
                                </li>
                            @endif
                        @endforeach
                    @else
                        <h4 style="text-align: center">没有任何东西啊</h4>
                    @endif
                </ul>
            </div>
        </div>
    </div>

@endsection

@section('javascript')

@endsection